//
//  NewShangjiaImageinfoViewController.m
//  wangzhe
//
//  Created by 李 佳伟 on 2018/4/3.
//  Copyright © 2018年 李 佳伟. All rights reserved.
//

#import "NewShangjiaImageinfoViewController.h"
#import "JTCSM.h"
static CGFloat idcardBili = 0.641026;
static CGFloat space = 20;
static CGFloat headerHeight = 50;
@interface NewShangjiaImageinfoViewController ()
{
    CGFloat imagewidth;
    CGFloat imageHeight;
}
@property (nonatomic,strong) UIImageView *IDCardZhengImageV;
@property (nonatomic,strong) UIImageView *IDCardFanImageV;
@property (nonatomic,strong) UIImageView *yingyeImageV;
@property (nonatomic,strong) UIImageView *zuzhidaimaImageV;
@property (nonatomic,strong) UIImageView *weishengxukeImageV;
@property (nonatomic,strong) UIImageView *mendianImageV;
@property (nonatomic,strong) UIImageView *jingyingaddressImageV;
@property (nonatomic,strong) UIImageView *shouyintaiImageV;
@end

@implementation NewShangjiaImageinfoViewController

- (void)gotBack{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationController.navigationBar.hidden = NO;
    [self.view setBackgroundColor:[UIColor whiteColor]];
    [df isRemoveTarbar:YES];
    leftBarButtonItems_rightBarButtonItems *leftbtn = KCUSTOMNAVIGSTION_ALLOC;
    self.navigationItem.leftBarButtonItem = [leftbtn setBarButtonItemsImageName:@"fanhui.png" frame:KLeftBarButtonItemFrame_image target:self SEL:@selector(gotBack)];
    
    UIScrollView *backScrollview = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, KCONTROLLERWith, KCONTROLLERHeight)];
    backScrollview.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:backScrollview];
    
    
    [backScrollview addSubview:[self LayoutHeaderWithTop:0 text:@"为保障顺利通过审核，请上传真实附件信息。"]];
    imagewidth = (KCONTROLLERWith/2-space-space/2);
    imageHeight = imagewidth*idcardBili;
    
    self.IDCardZhengImageV = [[UIImageView alloc]initWithFrame:CGRectMake(space, headerHeight+space, imagewidth, imageHeight)];
    self.IDCardZhengImageV.image = [UIImage imageNamed:@"身份证正面.png"];
    [backScrollview addSubview:self.IDCardZhengImageV];
    [self layoutSpringViewWithText:@"上传身份证正面" superView:self.IDCardZhengImageV];
    
    
    self.IDCardFanImageV = [[UIImageView alloc]initWithFrame:CGRectMake(KVIEW_X(self.IDCardZhengImageV)+space, headerHeight+space, imagewidth, imageHeight)];
    self.IDCardFanImageV.image = [UIImage imageNamed:@"身份证反面.png"];
    [backScrollview addSubview:self.IDCardFanImageV];
    [self layoutSpringViewWithText:@"上传身份证反面" superView:self.IDCardFanImageV];
    
    
    self.yingyeImageV = [[UIImageView alloc]initWithFrame:CGRectMake(space, KVIEW_Y(self.IDCardZhengImageV)+space/2, imagewidth, imageHeight)];
    _yingyeImageV.image = [UIImage imageNamed:@"营业执照.png"];
    [backScrollview addSubview:_yingyeImageV];
    [self layoutSpringViewWithText:@"上传营业执照" superView:self.yingyeImageV];
    
    
    self.zuzhidaimaImageV = [[UIImageView alloc]initWithFrame:CGRectMake(KVIEW_X(self.IDCardZhengImageV)+space, KVIEW_Y(self.IDCardZhengImageV)+space/2, imagewidth, imageHeight)];
    self.zuzhidaimaImageV.image = [UIImage imageNamed:@"组织机构代码.png"];
    [backScrollview addSubview:self.zuzhidaimaImageV];
    [self layoutSpringViewWithText:@"上传组织机构代码" superView:self.zuzhidaimaImageV];
    
    UIView *zhongjianView = [self LayoutHeaderWithTop:KVIEW_Y(self.zuzhidaimaImageV)+space/2 text:@"如行业类型为食品或餐饮，请上传《食品卫生许可证》"];
    [backScrollview addSubview:zhongjianView];
    
    
    self.weishengxukeImageV = [[UIImageView alloc]initWithFrame:CGRectMake(space, KVIEW_Y(zhongjianView)+space/2, imagewidth, imageHeight)];
    self.weishengxukeImageV.image = [UIImage imageNamed:@"食品卫生许可证.png"];
    [backScrollview addSubview:self.weishengxukeImageV];
    [self layoutSpringViewWithText:@"点击上传" superView:self.weishengxukeImageV];
    
    UIView *bottomeView = [self LayoutHeaderWithTop:KVIEW_Y(self.weishengxukeImageV)+space/2 text:@"为保障顺利通过审核，请上传真实附件信息。"];
    [backScrollview addSubview:bottomeView];
    
    
    self.mendianImageV = [[UIImageView alloc]initWithFrame:CGRectMake(space, KVIEW_Y(bottomeView)+space/2, imagewidth, imageHeight)];
    self.mendianImageV.image = [UIImage imageNamed:@"门店照.png"];
    [backScrollview addSubview:self.mendianImageV];
    [self layoutSpringViewWithText:@"上传门店照" superView:self.mendianImageV];
    
    self.jingyingaddressImageV = [[UIImageView alloc]initWithFrame:CGRectMake(KVIEW_X(self.IDCardZhengImageV)+space, KVIEW_Y(bottomeView)+space/2, imagewidth, imageHeight)];
    self.jingyingaddressImageV.image = [UIImage imageNamed:@"经营场地.png"];
    [backScrollview addSubview:self.jingyingaddressImageV];
     [self layoutSpringViewWithText:@"上传营业场地" superView:self.jingyingaddressImageV];
    
    self.shouyintaiImageV = [[UIImageView alloc]initWithFrame:CGRectMake(space, KVIEW_Y(_mendianImageV)+space/2, imagewidth, imageHeight)];
    self.shouyintaiImageV.image = [UIImage imageNamed:@"收银台照.png"];
    [backScrollview addSubview:self.shouyintaiImageV];
     [self layoutSpringViewWithText:@"上传收银台照" superView:self.shouyintaiImageV];
    
    [backScrollview setContentSize:CGSizeMake(KCONTROLLERWith, KVIEW_Y(self.shouyintaiImageV)+space)];
    
}


- (UIView *)LayoutHeaderWithTop:(CGFloat)top text:(NSString *)text{
    UIView *infoView = [[UIView alloc]initWithFrame:CGRectMake(0, top, KCONTROLLERWith, headerHeight)];
    infoView.backgroundColor = RGBACOLOR(241, 241, 241, 1);
    infoView.userInteractionEnabled = YES;
    
    NSString *infoStr = text;
    float infoSize = 12;
    CGRect inforect = [df labelHeightWithContent:infoStr height:headerHeight font:infoSize];
    UIImageView *infoImagev = [[UIImageView alloc]initWithFrame:CGRectMake(space, (headerHeight-inforect.size.height)/2, inforect.size.height, inforect.size.height)];
    infoImagev.image = [UIImage imageNamed:@"tanhao.png"];
    [infoView addSubview:infoImagev];
    
    UILabel *infolabel = [UILabel initWithFrame:CGRectMake(KVIEW_X(infoImagev)+5, (headerHeight-inforect.size.height)/2, KCONTROLLERWith, inforect.size.height) text:infoStr font:infoSize textAlignment:NSTextAlignmentLeft texcolor:[df colorWithHexString:@"666666" alpha:1] backgroundColor:nil];
    [infoView addSubview:infolabel];
    
    return infoView;
}

- (void )layoutSpringViewWithText:(NSString *)text superView:(UIView *)superview{
    UIView *springView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, imagewidth, imageHeight)];
    springView.backgroundColor = [UIColor clearColor];
    springView.userInteractionEnabled = YES;
    
    CGFloat imagesize = 40;
    CGFloat labelHeight = 30;
    CGFloat changeheight = 2;
    CGFloat top = (imageHeight-imagesize-labelHeight-changeheight)/2;
    UIImageView *imagev = [[UIImageView alloc]initWithFrame:CGRectMake((imagewidth-imagesize)/2, top, imagesize, imagesize)];
    imagev.image = [UIImage imageNamed:@"照片image.png"];
    imagev.userInteractionEnabled = YES;
    [springView addSubview:imagev];
    
    UILabel *label = [UILabel initWithFrame:CGRectMake(0, KVIEW_Y(imagev)+changeheight, imagewidth, labelHeight) text:text font:12 textAlignment:NSTextAlignmentCenter texcolor:[df colorWithHexString:@"666666" alpha:1] backgroundColor:nil];
    label.userInteractionEnabled = YES;
    [springView addSubview:label];
    [superview addSubview:springView];
    [superview bringSubviewToFront:springView];
    [superview setUserInteractionEnabled:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
